import sqlite3

# 修改
con = sqlite3.connect("db1.db")
sql = 'update t_person set pname=? where pno=?'
cursor = con.cursor()

try:
    cursor.execute(sql,('王五',1))
    con.commit()
    print("修改成功")
except Exception as e:
    print(e)
    print("修改数据失败")
finally:
    cursor.close()
    con.close()